//获取rem值
function Rem(doc, win, designw) {
    var docEl = doc.documentElement,resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize';
    var recalc = function () {

        var clientWidth = docEl.clientWidth > 768 ? 768 : docEl.clientWidth <= 320 ? 320 : docEl.clientWidth;

        if (!clientWidth) return;

        docEl.style.fontSize = (clientWidth / designw * 100).toFixed(2) + "px";
    };
    recalc();
    if (!doc.addEventListener) return;
    win.addEventListener(resizeEvt, recalc, false);
};
Rem(document, window, 640);